﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;

using SwenAssigment.Classes;
namespace SwenAssigment
{
    public partial class RoomAvalibility : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["mystat"] != null)
            {
                Label1.Text = Session["mystat"].ToString();
                Label1.Visible = true;
                Session["mystat"] = null;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string line = "select * from room";
            if (DropDownList1.Text != "All" | DropDownList2.Text != "All")
            {
                line += " where ";
            }
            if (DropDownList1.Text == "Superior")
            {
                line += "Description='Superior'";
            }
            else if (DropDownList1.Text == "Deluxe")
            {
                line += "Description='Deluxe'";
            }
            else if (DropDownList1.Text == "Suite")
            {
                line += "Description='Suite'";
            }
            else if (DropDownList1.Text == "Executive")
            {
                line += "Description='Executive'";
            }
            else if (DropDownList1.Text == "Executive Suite")
            {
                line += "Description='Executive Suite'";
            }

            if (DropDownList2.Text != "All" & DropDownList1.Text != "All")
            {
                line += " and ";
            }
            if (DropDownList2.Text == "Vacant")
            {
                line += "status='Vacant'";
            }
            else if (DropDownList2.Text == "Occupied")
            {
                line += "status='Occupied'";
            }
            else if (DropDownList2.Text == "Vacant - To be cleaned")
            {
                line += "status='Clean'";
            }
            else if (DropDownList2.Text == "Room service")
            {
                line += "status='Service'";
            }

            try
            {
                RADcon con = new RADcon();
                ArrayList al = con.raretrieve(line);
                GridView1.DataSource = al;
                GridView1.DataBind();
            }
            catch
            {
            }
        }
    }
}